﻿//开启依赖加载
Ext.Loader.setConfig({ enabled: true });

//设置扩展路径
Ext.Loader.setPath('Ext.ux', '../Scripts/extjs4.2.1/ux'); //设置命名空间"Ext.ux"的路径
Ext.application({
    name: 'Roy',
    appFolder: '../Scripts/app',
    autoCreateViewport: false,
    controllers: ['main.MainController'],
    requires: ['Roy.view.Viewport'],    
    launch: function () {
        //Ext.get('loading').destroy();
        Ext.create('Roy.view.Viewport');
        /** 会话超时检测 */
        Ext.Ajax.on('requestcomplete',
    		function (connection, response, options) {
    			try {
    				var sessionStatus = response.getResponseHeader("sessionStatus");
    				if (sessionStatus == "timeout") {
    				    Ext.Msg.show({
    				        title: '提示',
    				        width: 350,
    				        modal: true,
    				        closable: true,
    				        buttons: Ext.Msg.OK,
    				        fn: function (btn, text) {
    				            if (btn == 'ok') {
    				                window.location = 'login.html';
    				            }
    				        },
    				        msg: '会话超时，3秒后自动跳转到登录页面',
    				        icon: Ext.MessageBox.INFO
    				    });

    				    Ext.defer(function () {
    				        window.location = 'login.html';
    				    }, 3000);
    				}
    			} catch (e) {
    			}
    		}, this);

        // 删除背景图片
        //var bd = Ext.dom.Query.select('body')[0];
        //bd.style.background = "";
    }
});
